package com.stadium.common.enums;

public enum PositionEnum {

    POINT_GUARD("1", "后锋"),

    SHOOTING_GUARD("2", "前锋"),

    UNKNOWN("0", "未知");
    private String code;
    private String name;

    PositionEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static PositionEnum getPositonByCode(Integer code) {
        for (PositionEnum positionEnum : PositionEnum.values()) {
            if (code.equals(positionEnum.getCode())) {
                return positionEnum;
            }
        }
        return PositionEnum.UNKNOWN;
    }

    public static PositionEnum getPositonByName(String name) {
        for (PositionEnum positionEnum : PositionEnum.values()) {
            if (name.equals(positionEnum.getName())) {
                return positionEnum;
            }
        }
        return PositionEnum.UNKNOWN;
    }
}
